/*****************************************************************************
Copyright 2006 Kervin L. Pierre
    EMAIL: otlkcon@adevsoft.com

This file is part of Otlkcon.

Otlkcon is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

Otlkcon is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Lesser GNU General Public License for more details.

You should have received a copy of the Lesser GNU General Public License
along with Otlkcon; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*******************************************************************************/

#include "StdAfx.h"

#include "O_IStatus.h"

extern const IID IID_IMAPIStatus;


O_IStatus::O_IStatus()
{
    InitializeCriticalSection(&cs);
}

HRESULT O_IStatus::Create(otlkcon_memory *m)
{
    HRESULT result = S_OK;

    memObj = m;
    cRef = 1;

    result = CreateIProp(NULL,m->lpAllocateBuffer,m->lpAllocateMore,
                            m->lpFreeBuffer,NULL,lppPropData);

    return result;
}

HRESULT O_IStatus::Destroy()
{
    HRESULT result = S_OK;

    return result;
}

STDMETHODIMP O_IStatus::QueryInterface (REFIID riid, void **ppv)
{
    HRESULT result = S_OK;

    OTLKCON_LOG_PRINTF(OTLKCON_LOG_LEVEL_INFO, OTLKCON_LOG_TARGET_ALL, 
        L"inside O_IStatus->QueryInterface().\n");

    *ppv = NULL;

    if( memcmp(&riid, &IID_IUnknown, sizeof(IID)) &&
        memcmp(&riid, &IID_IMAPIProp, sizeof(IID)) &&
        memcmp(&riid, &IID_IMAPIStatus, sizeof(IID)))
    { 
        result = ResultFromScode(E_NOINTERFACE);
        return result;
    }

    AddRef();
    *ppv = (LPVOID)this;

    return result;
}

ULONG STDMETHODCALLTYPE O_IStatus::AddRef (void)
{
    return ++cRef;
}

ULONG STDMETHODCALLTYPE O_IStatus::Release (void)
{
    if ( --cRef == 0 )
    {
        Destroy();
    }

    return cRef;
}

STDMETHODIMP O_IStatus::ValidateState(
  ULONG ulUIParam,
  ULONG ulFlags      
)
{
    HRESULT result = S_OK;

    return result;
}
 
STDMETHODIMP O_IStatus::SettingsDialog(
  ULONG ulUIParam,
  ULONG ulFlags      
)
{
    HRESULT result = S_OK;

    return result;
}
 
STDMETHODIMP O_IStatus::ChangePassword(
  LPTSTR lpOldPass,
  LPTSTR lpNewPass,
  ULONG ulFlags       
)
{
    HRESULT result = S_OK;

    return result;
}

STDMETHODIMP O_IStatus::FlushQueues(
  ULONG ulUIParam,
  ULONG cbTargetTransport,
  LPENTRYID lpTargetTransport,
  ULONG ulFlags              
)
{
    HRESULT result = S_OK;

    return result;
}

STDMETHODIMP O_IStatus::GetLastError(HRESULT hResult,
  ULONG ulFlags,
  LPMAPIERROR *lppMAPIError  
)
{
    HRESULT result = S_OK;

    return result;
}

STDMETHODIMP O_IStatus::SaveChanges( ULONG ulFlags )
{
  HRESULT result = S_OK;

  return result;
}

STDMETHODIMP O_IStatus::GetProps(LPSPropTagArray lpPropTagArray,
                      ULONG        ulFlags,
                      ULONG        *lpcValues,
                      LPSPropValue *lppPropArray
)
{
    HRESULT result = S_OK;

    return result;
}

STDMETHODIMP O_IStatus::GetPropList( ULONG ulFlags,
                                  LPSPropTagArray *lppPropTagArray)
{
    HRESULT result = S_OK;

    return result;
}

STDMETHODIMP O_IStatus::SetProps(ULONG cValues, 
                               LPSPropValue lpPropArray,
                               LPSPropProblemArray *lppProblems )
{
    HRESULT result = S_OK;


    return result;
}

STDMETHODIMP O_IStatus::DeleteProps(LPSPropTagArray lpPropTagArray,
                                        LPSPropProblemArray *lppProblems  )
{
    HRESULT result = MAPI_E_NO_SUPPORT;

    OTLKCON_LOG_PRINTF(OTLKCON_LOG_LEVEL_INFO,  OTLKCON_LOG_TARGET_ALL, 
        L"FIXME: inside O_IStatus::DeleteProps()\n" );

    return result;
}

STDMETHODIMP O_IStatus::CopyTo(ULONG ciidExclude,
  LPCIID rgiidExclude,
  LPSPropTagArray lpExcludeProps,
  ULONG ulUIParam,
  LPMAPIPROGRESS lpProgress,
  LPCIID lpInterface,
  LPVOID lpDestObj,
  ULONG ulFlags,
  LPSPropProblemArray *lppProblems  
)
{
    HRESULT result = MAPI_E_NO_SUPPORT;

    OTLKCON_LOG_PRINTF(OTLKCON_LOG_LEVEL_INFO,  OTLKCON_LOG_TARGET_ALL, 
        L"FIXME: inside O_IStatus::CopyTo()\n" );

    return result;
}

STDMETHODIMP O_IStatus::CopyProps(
    LPSPropTagArray lpIncludeProps,
    ULONG ulUIParam,
    LPMAPIPROGRESS lpProgress,
    LPCIID lpInterface,
    LPVOID lpDestObj,
    ULONG ulFlags,
    LPSPropProblemArray *lppProblems  
)
{
    HRESULT result = MAPI_E_DECLINE_COPY;

    OTLKCON_LOG_PRINTF(OTLKCON_LOG_LEVEL_INFO,  OTLKCON_LOG_TARGET_ALL, 
        L"FIXME: inside O_IStatus::CopyProps()\n" );

    return result;
}

STDMETHODIMP O_IStatus::GetNamesFromIDs(
                        LPSPropTagArray *lppPropTags,
                        LPGUID lpPropSetGuid,
                        ULONG ulFlags,
                        ULONG *lpcPropNames,
                        LPMAPINAMEID **lpppPropNames  
)
{
    HRESULT result = S_OK;

    OTLKCON_LOG_PRINTF(OTLKCON_LOG_LEVEL_INFO,  OTLKCON_LOG_TARGET_ALL, 
        L"FIXME: inside O_IStatus::GetNamesFromIDs()\n" );

    return MAPI_E_NO_SUPPORT;
}

STDMETHODIMP O_IStatus::GetIDsFromNames(
  ULONG cPropNames,
  LPMAPINAMEID *lppPropNames,
  ULONG ulFlags,
  LPSPropTagArray *lppPropTags  
)
{
    HRESULT result = S_OK;

    return MAPI_E_NO_SUPPORT;
}


STDMETHODIMP O_IStatus::OpenProperty(ULONG ulPropTag,
  LPCIID lpiid,
  ULONG ulInterfaceOptions,
  ULONG ulFlags,
  LPUNKNOWN *lppUnk  
)
{
    HRESULT result  = S_OK;

    return result;
}
